package programmercarl.动态规划.C19;

class Solution1 {
    public int change(int amount, int[] coins) {//完全背包
        int[] dp = new int[amount + 1];
        dp[0] = 1;

        //dp[i]为硬币数为x时最大的组合数
        for (int i = 1; i < coins.length; i++) {
            for (int j = coins[i]; j <=amount; j++) {
                dp[j] += dp[j - coins[i]];
            }
        }
        //5   1 2  5
        //

        return dp[amount];
    }
}